﻿Imports System.Data
Public Class ClerkManage
    Public Shared Function clerkmanange(ByVal ygbh As String, ByRef Level As Long) As DataSet
        Dim Ds As DataSet = GlobalClass.SQLclass.Sqlcmd("select * from ClerkInfo where 员工编号 = '" + ygbh + "'", "ClerkInfo")
        If Ds.Tables("ClerkInfo").Rows.Count > 0 Then
            Ds.Clear()
            Ds = GlobalClass.SQLclass.Sqlcmd("select * from ClerkInfo where 员工编号 = '" + ygbh + "'", "ClerkInfo1")
            Ds = GlobalClass.SQLclass.Sqlcmd("select * from UserInfo where 员工号='" + ygbh + "'", "TT")
            Level = Ds.Tables("TT").Rows(0)("职位")
        Else
            Throw New Exception("未找到该员工的信息!")
        End If
        Return Ds
    End Function
    Public Shared Sub clerkmanange(ByVal ygbh As String, _
                                        ByVal name As String, _
                                        ByVal sex As Boolean, _
                                        ByVal mary As Boolean, _
                                        ByVal phone As String, _
                                        ByVal address As String, _
                                        ByVal zhiwei As Integer, _
                                        ByVal money As Integer)
        Dim Ds As DataSet = GlobalClass.SQLclass.Sqlcmd("select 员工编号 from ClerkInfo where 员工编号 = '" + ygbh + "'")
        If Ds.Tables(0).Rows.Count > 0 Then
            Ds = GlobalClass.SQLclass.Sqlcmd("update ClerkInfo set 姓名='" & name & "',性别=" & Convert.ToInt32(sex).ToString & ",婚否=" & Convert.ToInt32(mary).ToString & ",电话='" & phone & "',住址='" & address & "',薪金=" & money.ToString & " where 员工编号 ='" & ygbh & "'")
            Ds = GlobalClass.SQLclass.Sqlcmd("update UserInfo set 职位=" & zhiwei.ToString & " where 员工号 ='" + ygbh + "'")
        Else
            Throw New Exception("更新用户数据失败!")
        End If
    End Sub
End Class
